import { Component, Input, OnInit } from '@angular/core';
import { BoardGroupVo } from 'src/app/model/board-group-vo';
import { ThreadsService } from 'src/app/services/threads.service';
import { Observable } from 'rxjs';
import { ThreadsCollectStatsVo } from 'src/app/model/threads-collect-stats-vo';
import { environment } from 'src/environments/environment';
@Component({
  selector: 'app-board-group-recent-threads',
  templateUrl: './board-group-recent-threads.component.html',
  styles: [``]
})
/**
 * 版块组主页中的最近话题[Embed]
 * @constructor
 */
export class BoardGroupRecentThreadsComponent implements OnInit {
  @Input('volume')
  public boardGroupVo: BoardGroupVo | undefined;
  public items$!: Observable<ThreadsCollectStatsVo[]>;

  constructor(private threadsService: ThreadsService) { }

  ngOnInit(): void {
    if (this.boardGroupVo) {
      this.items$ = this.threadsService.getRecentForVolumes(this.boardGroupVo.id, environment.recentSize);
    }
  }

}
